<?php 
include '../functions.php';
//作业1：编写多文件上传处理函数
function manyUpload(){
	p($_FILES);
	foreach ($_FILES as $v) {
		foreach ($v['tmp_name'] as $key => $value) {
			if(is_uploaded_file($value)){
				//上传目录
				$path = './Upload/' . date('ymd');
				is_dir($path) || mkdir($path,0777,true);
				//文件名
				$type = ltrim(strrchr($v['name'][$key], '.'),'.');
				$fileName = time() . mt_rand(0, 999999) . '.' . $type;
				$dest = $path . '/' . $fileName;
				//移动上传文件
				move_uploaded_file($value, $dest);
			}
		}
	}
}
manyUpload();



 ?>
 <!doctype html>
 <html lang="en">
 <head>
 	<meta charset="UTF-8" />
 	<title>Document</title>
 </head>
 <body>
 	<form action="" method="post" enctype="multipart/form-data">
 		文件1：  
 		<input type="file" name="upfiles[]" id="" />
 		<br />
 		文件1：  
 		<input type="file" name="upfiles[]" id="" />
 		<br />
 		<input type="submit" value="上传"/>
 	</form>
 </body>
 </html>